package action;

import grammer.Predicate;
import grammer.components.PredicateEnum;
import timer.Timer;
import action.concreteActions.ContextAction;
import action.concreteActions.SimpleUseAction;
import action.concreteActions.TerminalAction;

public class Class1Actionfactory {

	static ActionSInterface selectAction(Timer t, Predicate p) {
		ActionSInterface selected = null;
		if (p.getPredicate().equals(PredicateEnum.TURNS_EVERYTHING_OFF)
				|| p.getPredicate().equals(PredicateEnum.DRINKS)
				|| p.getPredicate().equals(PredicateEnum.OPENS_WINDOW)
				|| p.getPredicate().equals(PredicateEnum.CLOSES_WINDOW)) {
			selected = new SimpleUseAction(t, p);
		}
		if (p.getPredicate().equals(PredicateEnum.LEAVES)
				|| p.getPredicate().equals(PredicateEnum.COMES_HOME)) {
			selected = new ContextAction(t, p);
		}
		if (p.getPredicate().equals(PredicateEnum.GOES_TO_BED)) {
			selected = new TerminalAction(t, p);
		}
		return selected;
	}
}
